home *** CD-ROM | disk | FTP | other *** search
- /*****************************************************************************************
- Context-Sensitive-Help API for WebHelp Enterprise, RoboInfo and WebHelp
- eHelp« Corporation
- Copyright⌐ 1998-2001 eHelp« Corporation.All rights reserved.
- *****************************************************************************************/
-
- // if you are using VC++, please go to menu Project|Settings...,
- // set RoboHelp_CSH.cpp not using precompiled headers.
- // Otherwize you will get compiling: c1010: unexpected eof while looking for precompiled header directive.
-
- /* Example function calls
- // First, create RH_WindowOption object
- RH_WindowOption MyWin;
- // Set window style and position in object
- MyWin.m_nStyle = RHWO_LOCATION | RHWO_MENUBAR | RHWO_RESIZABLE;
- MyWin.m_nTop = 50;
- MyWin.m_nLeft=50;
- MyWin.m_nHeight=300;
- MyWin.m_nWidth=400;
-
- // Show Help for topic with HTML Help Map number 11:
- RH_ShowHelpById("c:\\myapp\\help\\start_rhc.htm", "11", "myHelpWindow", MyWin);
-
- // Show Help for topic with Context String ID "My_Topic"
- RH_ShowHelpByString("c:\\myapp\\help\\start_rhc.htm"", "My_Topic", "myHelpWindow", MyWin);
- */
-
- #include <process.h>
- #include <stdlib.h>
- #include <stdio.h>
-
- #ifdef _WIN32 //Win32 platform
- #include <windows.h>
- #include <shellapi.h>
- #include <MSHTML.H> // IE Interfaces.
- #include <Exdisp.h>
- #else //non-Win32 platform, probably Unix. here we include a header file for unix.
- #include <unistd.h>
- #endif
-
-
- #include "RoboHelp_Csh.h"
-
- #pragma warning( disable : 4702 )
-
- /* constant */
- #define DEFAULT_RH_TARGET_ID ""
- #define AUTOCONTEXTID_PREFIX "HelpIdFromHTMLHelp" // the prefix used to auto translate from topic number to context id
- /* static local variable*/
- static char s_szBrowserName[MAX_PATH] = "netscape";
- static int gbCoInited=0;
-
- //////////////////////////////////////////////////////////////////////////////
- #ifdef _WIN32
-
- GUID RH_IID_ITargetFrame2 = {0x86D52E11, 0x94A8, 0x11d0, {0x82,0xAF,0x00,0xC0,0x4F,0xD5,0xAE,0x38}};
-
- interface ITargetFrame2 : public IUnknown
- {
- public:
- virtual HRESULT STDMETHODCALLTYPE SetFrameName(
- /* [in] */ LPCWSTR pszFrameName) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE GetFrameName(
- /* [out] */ LPWSTR __RPC_FAR *ppszFrameName) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE GetParentFrame(
- /* [out] */ IUnknown __RPC_FAR *__RPC_FAR *ppunkParent) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE SetFrameSrc(
- /* [in] */ LPCWSTR pszFrameSrc) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE GetFrameSrc(
- /* [out] */ LPWSTR __RPC_FAR *ppszFrameSrc) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE GetFramesContainer(
- /* [out] */ IOleContainer __RPC_FAR *__RPC_FAR *ppContainer) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE SetFrameOptions(
- /* [in] */ DWORD dwFlags) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE GetFrameOptions(
- /* [out] */ DWORD __RPC_FAR *pdwFlags) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE SetFrameMargins(
- /* [in] */ DWORD dwWidth,
- /* [in] */ DWORD dwHeight) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE GetFrameMargins(
- /* [out] */ DWORD __RPC_FAR *pdwWidth,
- /* [out] */ DWORD __RPC_FAR *pdwHeight) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE FindFrame(
- /* [unique][in] */ LPCWSTR pszTargetName,
- /* [in] */ DWORD dwFlags,
- /* [out] */ IUnknown __RPC_FAR *__RPC_FAR *ppunkTargetFrame) = 0;
-
- virtual HRESULT STDMETHODCALLTYPE GetTargetAlias(
- /* [unique][in] */ LPCWSTR pszTargetName,
- /* [out] */ LPWSTR __RPC_FAR *ppszTargetAlias) = 0;
-
- };
-
-
- IWebBrowser2* GetBrowser()
- {
- IWebBrowser2 *pBrowser = NULL;
- // If the caller already initialize COM, please comment out the next 5 lines.
- if (!gbCoInited)
- {
- ::CoInitialize(NULL);
- gbCoInited=1;
- }
- CoCreateInstance(CLSID_InternetExplorer, NULL, CLSCTX_LOCAL_SERVER,IID_IWebBrowser2, (LPVOID FAR*)&pBrowser);
- return pBrowser;
- };
-
- #endif
-
- /* local static routines */
- static int IsServerBased(const char *a_pszUrlToHelpSet);
- static int MakeUrlForServerBased(const char *a_pszUrlToHelpSet, const char *a_pszContextID, char *a_pszResult);
- static int MakeUrlForWebHelpBased(const char *a_pszUrlToHelpSet, const char *a_pszContextID, char *a_pszResult);
-
- static int ShowHelpTopic_Win32(const char *a_pszUrl,RH_WindowOption *a_pWndOption, const char *a_pszTargetID);
- static int ShowHelpTopic_NonWin32(const char *a_pszUrl,RH_WindowOption *a_pWndOption, const char *a_pszTargetID);
-
- #ifdef _WIN32
- static int ShowHelpTopic_Win32_IE(const char *a_pszUrl,RH_WindowOption *a_pWndOption, const char *a_pszTargetID);
- static int ShowHelpTopic_Win32_NonIE(const char *a_pszUrl,RH_WindowOption *a_pWndOption);
- #endif
-
- /**********************************************
- Show Help topic by topic number generated for HtmlHelp.
- Parameters:
- [in] a_pszUrlToHelpSet: url to helpset. for WebHelp Enterprise it is the url to server name, such as "http://helpserver.com/RoboApi.asp"
- for webhelp, it is full path name the webhelp start page name, such as "c:\myapp\help\start_rhc.htm" or "/user/myapp/help/start_rhc.htm"
- [in] a_nTopicNumber: topic number generated for the HTMLHelp context sensitive help.
- [in] a_pszTargetID: browser's target name, such as "mynewtopic"
- [in] a_pcWindowOption: browser options. can be 0.
- Result:
- 0: successful
- non-0: error code.
- **********************************************/
-
- int RH_ShowHelpById(const char * a_pszUrlToHelpSet,
- unsigned long a_nTopicNumber,
- const char * a_pszTargetID,
- RH_WindowOption * a_pcWindowOption)
- {
- char szAutoContextID[MAX_PATH];
- sprintf(szAutoContextID, "%s_%d", AUTOCONTEXTID_PREFIX, a_nTopicNumber);
- return RH_ShowHelpByString(a_pszUrlToHelpSet, szAutoContextID, a_pszTargetID, a_pcWindowOption);
- }
-
- /******************************************************************************************************************************************
- Show Help topic
- Parameters:
- [in] a_pszUrlToHelpSet: url to helpset. for WebHelp Enterprise it is the url to server name, such as "http://helpserver.com/RoboApi.asp"
- for webhelp, it is full path name the webhelp start page name, such as "c:\myapp\help\start_rhc.htm" or "/user/myapp/help/start_rhc.htm"
- [in] a_pszContextID: context id of the topic
- [in] a_pszTargetID: browser's target name, such as reserved "_top","_parent" or custmized "myhelpwindow"
- [in] a_pcWindowOption: browser options. can be 0.
- Result:
- 0: successful
- non-0: error code.
- ******************************************************************************************************************************************/
-
- int RH_ShowHelpByString(const char * a_pszUrlToHelpSet,
- const char * a_pszContextID,
- const char * a_pszTargetID,
- RH_WindowOption * a_pcWindowOption)
- {
- char szUrl[MAX_RH_URL_BUFLEN];
- char szContextID[MAX_RH_URL_BUFLEN];
- char szTarget[256];
- RH_WindowOption cOpt;
- int nMake;
-
- if (a_pszUrlToHelpSet == NULL)
- return -1;
-
- //init
- szUrl[0] = 0x00;
- szContextID[0] = 0x00;
- memset(&cOpt,0,sizeof(RH_WindowOption));
- strncpy(szTarget,DEFAULT_RH_TARGET_ID,255);
-
- //Make safe default value of context id and windowoption
- if (a_pszContextID != 0)
- strncpy(szContextID,a_pszContextID,MAX_RH_URL_BUFLEN);
- if (a_pcWindowOption != 0)
- {
- memcpy(&cOpt,a_pcWindowOption,sizeof(RH_WindowOption));
- }
- else
- {
- cOpt.m_nStyle = 0;
- cOpt.m_nTop = 10;
- cOpt.m_nLeft = 10;
- cOpt.m_nHeight = 300;
- cOpt.m_nWidth = 400;
- }
-
- //can different agent to make url.
- if (IsServerBased(a_pszUrlToHelpSet))
- {
- nMake = MakeUrlForServerBased(a_pszUrlToHelpSet,szContextID,szUrl);
- }
- else
- {
- nMake = MakeUrlForWebHelpBased(a_pszUrlToHelpSet,szContextID,szUrl);
- }
-
- //bring up the topic now.
- if (nMake == 0)
- {
- if (a_pszTargetID != 0)
- strcpy(szTarget,a_pszTargetID);
- #ifdef _WIN32
- return ShowHelpTopic_Win32(szUrl,&cOpt,szTarget);
- #else
- return ShowHelpTopic_NonWin32(szUrl,&cOpt,szTarget);
- #endif
- }
- return -1;
- }
-
-
-
- /******************************************************************************************************************************************
- close browser with specific target name
- Parameter:
- [in] a_pszTargetID: browser's target name, such as reserved "_top","_parent" or custmized "myhelpwindow"
- Result:
- 0: successful
- non-0: error code.
- *******************************************************************************************************************************************/
- int RH_CloseHelpTarget(const char * a_pszTargetID)
- {
- #ifdef _WIN32
- //go to the page
- IWebBrowser2 *pBrowser = GetBrowser();
- if (pBrowser != NULL)
- {
- ITargetFrame2 *pTargetFrame2 = NULL;
- pBrowser->QueryInterface(RH_IID_ITargetFrame2, (void**) &pTargetFrame2);
- if (pTargetFrame2 != NULL)
- {
- BSTR bstrTarget;
- bstrTarget = ::SysAllocStringLen(NULL, strlen(a_pszTargetID));
- MultiByteToWideChar(CP_ACP, MB_USEGLYPHCHARS, a_pszTargetID, strlen(a_pszTargetID), bstrTarget,strlen(a_pszTargetID));
-
- IWebBrowser2 *pBrowser = NULL;
-
- //IE 5.0+
- IUnknown *pUnk = NULL;
- pTargetFrame2->FindFrame(bstrTarget,0,&pUnk);
- if (pUnk != NULL)
- {
- pUnk->QueryInterface(IID_IWebBrowser2,(void **)&pBrowser);
- if (pBrowser != NULL)
- {
- //It is easy to make the brower invisble,
- //otherwise there possilble two ways to close the browser:
- //1: Get hWnd of the browser and sent WM_QUIT to the host frame of this window
- //2: Get Container (OleContainer) and ask container close itself
- pBrowser->Quit();
- pBrowser->Release();
- }
- pUnk->Release();
- }
- pTargetFrame2->Release();
- }
- pBrowser->Quit();
- pBrowser->Release();
- }
- #endif
- return 0;
- }
-
-
- /******************************************************************************************************************************************
- Query the url to help topic by context id
- Parameters:
- [in] a_pszUrlToHelpSet: url to helpset. for WebHelp Enterprise it is the url to server name, such as "http://helpserver.com/RoboApi.asp"
- for webhelp, it is full path name the webhelp start page name, such as "c:\myapp\help\start_rhc.htm" or "/user/myapp/help/start_rhc.htm"
- [in] a_pszContextID: context id of the topic
- [out]a_pszRetUrlBuf: a buffer to receive the finial result url, it's lenght need at least MAX_RET_URL_BUFLEN (2048).
-
- Result Code:
- 0: successful
- non-0: error code.
-
- ******************************************************************************************************************************************/
- int RH_MakeTopicURL(const char * a_pszUrlToHelpSet,
- const char * a_pszContextID,
- char *a_pszRetUrlBuf)
- {
- if (IsServerBased(a_pszUrlToHelpSet))
- return MakeUrlForServerBased(a_pszUrlToHelpSet,a_pszContextID,a_pszRetUrlBuf);
- return MakeUrlForWebHelpBased(a_pszUrlToHelpSet,a_pszContextID,a_pszRetUrlBuf);
- }
-
-
- /**********************************************
- Query the url to help topic by context id
- Parameters:
- [in] a_pszBroserName default broser name such as "netscape" "iexplorer"
-
- Result Code:
- 0: successful
- non-0: error code.
-
- **********************************************/
- int RH_SetDefaultBrowser(const char * a_pszBrowserName)
- {
- strncpy(s_szBrowserName,a_pszBrowserName,MAX_PATH);
- return 0;
- }
-
-
-
-
-
-
- /**********************************************************************************************************
- *************************************** Internal routines *************************************************
- ***********************************************************************************************************/
-
- /* Is Server based or not (WebHelp Enterprise/RHI or WebHelp) */
- int IsServerBased(const char *a_pszUrlToHelpSet)
- {
- char *pDot = strrchr(a_pszUrlToHelpSet,'.');
- if ((pDot != 0) &&
- ((a_pszUrlToHelpSet + strlen(a_pszUrlToHelpSet) - pDot) == 4) &&
- (stricmp(pDot,".asp") == 0))
- {
- return 1;
- }
- return 0;
- }
-
- /* Make URL for WebHelp Enterprise/RHI */
- int MakeUrlForServerBased(const char *a_pszUrlToHelpSet, const char *a_pszContextID, char *a_pszResult)
- {
- if (a_pszResult != 0)
- {
- sprintf(a_pszResult,"%s?context=%s",a_pszUrlToHelpSet,a_pszContextID);
- return 0;
- }
- return -1;
- }
-
- /* Make URL for WebHelp */
- int MakeUrlForWebHelpBased(const char *a_pszUrlToHelpSet, const char *a_pszContextID, char *a_pszResult)
- {
- if (a_pszResult != 0)
- {
- //expact "start_rhc.htm" as start page for csh for "start.htm" project
- char szPath[MAX_RH_URL_BUFLEN];
- strncpy(szPath,a_pszUrlToHelpSet,MAX_RH_URL_BUFLEN);
-
- char szExt[6]; szExt[0] = 0x00;
-
- /* char *pDot = strrchr(szPath,'.');
- int nLen = strlen(szPath);
- char *pEnd = szPath + nLen;
- if ((pDot != 0) &&
- (((pEnd - pDot) == 4) || ((pEnd - pDot) == 5)))
- {
- strcpy(szExt,pDot);
- strcpy(pDot,"_rhc");
- strcat(pDot,szExt);*/
-
- sprintf(a_pszResult,"%s#context=%s",szPath,a_pszContextID);
- return 0;
- // }
- }
- return -1;
- }
-
- /* Show Help topic in non-Win32 platform */
- int ShowHelpTopic_NonWin32(const char *a_pszUrl)
- {
- /*for non-window 32 system, we call the browser directly.
- because it is impossible to dectect which browser is installed in non-win32 platform. so we have to hardcode the broser name to "netscape".
- for those, who have different browser, please update the browser name here.
- */
- return (execl(s_szBrowserName, a_pszUrl, 0) == -1)? -1: 0;
- }
-
- /* Show Help topic in Win32 platform */
- int ShowHelpTopic_Win32(const char *a_pszUrl,RH_WindowOption *a_pWndOption, const char *a_pszTargetID)
- {
- int nRet=0;
- #ifdef _WIN32
- IWebBrowser2 *pBrowser = GetBrowser();
- if (pBrowser!= NULL)
- {
- nRet=ShowHelpTopic_Win32_IE(a_pszUrl,a_pWndOption,a_pszTargetID);
- pBrowser->Quit();
- pBrowser->Release();
- }
- else
- nRet=ShowHelpTopic_Win32_NonIE(a_pszUrl,a_pWndOption);
-
- #endif
- return nRet;
- }
-
- #ifdef _WIN32
- static int ShowHelpTopic_Win32_IE(const char *a_pszUrl,RH_WindowOption *a_pWndOption, const char *a_pszTargetID)
- {
- HRESULT hr = 0;
- BSTR bstrTarget;
- bstrTarget = ::SysAllocStringLen(NULL, strlen(a_pszTargetID));
- MultiByteToWideChar(CP_ACP, MB_USEGLYPHCHARS, a_pszTargetID, strlen(a_pszTargetID), bstrTarget,strlen(a_pszTargetID));
-
- IWebBrowser2 *pBrowser = GetBrowser();
- if (!pBrowser) return 0;
-
- int len = strlen(a_pszUrl);
- BSTR bstr;
- bstr = ::SysAllocStringLen(NULL, len);
- MultiByteToWideChar(CP_ACP, MB_USEGLYPHCHARS, a_pszUrl, strlen(a_pszUrl), bstr, len);
-
- VARIANT vFlags = {0};
- V_VT(&vFlags) = VT_I4;
- V_I4(&vFlags) = 0;
-
- VARIANT vPostData = {0};
- VARIANT vTargetFrameName = {0};
-
- // Put data into safe array.
- LPSAFEARRAY psa = SafeArrayCreateVector(VT_UI1, 0, 0);
-
- LPSTR pPostData;
- hr=SafeArrayAccessData(psa, (LPVOID*)&pPostData);
- hr = SafeArrayUnaccessData(psa);
-
- // Package the SafeArray into a VARIANT.
- V_VT(&vPostData) = VT_ARRAY | VT_UI1;
- V_ARRAY(&vPostData) = psa;
-
- // Get Headers.
- VARIANT vHeaders = {0};
- V_VT(&vHeaders) = VT_BSTR;
-
- // Specify a binary Content-Type.
- V_BSTR(&vHeaders) = SysAllocString(
- L"Content-Type: application/octet-stream\r\n"
- L"Content-Encoding: html/text\r\n");
-
- //target name
- V_VT(&vTargetFrameName) = VT_BSTR;
- V_BSTR(&vTargetFrameName) = SysAllocString(bstrTarget); // want to set framename? use ITargetFrame2 first. otherwise a new browser will open.
-
- ITargetFrame2 *pTargetFrame2= NULL;
- pBrowser->QueryInterface(RH_IID_ITargetFrame2, (void**)&pTargetFrame2);
- if (pTargetFrame2 != NULL)
- {
- if (strlen(a_pszTargetID) > 0)
- {
- //IE 5.0+
- IUnknown *pUnk = NULL;
- pTargetFrame2->FindFrame(bstrTarget,0,&pUnk);
- if (pUnk != NULL)
- {
- IWebBrowser2 *pBrowser2 = NULL;
- pUnk->QueryInterface(IID_IWebBrowser2,(void **)&pBrowser2);
- if (pBrowser2 != NULL)
- {
- pBrowser->Quit();
- pBrowser->Release();
- pBrowser = pBrowser2;
- }
- pUnk->Release();
- }
- else
- {
- hr=pTargetFrame2->SetFrameName(bstrTarget);
- if (!SUCCEEDED(hr))
- {
- pBrowser->Quit();
- pBrowser->Release();
- return 0;
- }
- }
- }
- pTargetFrame2->Release();
- }
- hr=pBrowser->Navigate(bstr, &vFlags, &vTargetFrameName, &vPostData, &vHeaders);
- //apply the style and size
- hr=pBrowser->put_ToolBar((short)((a_pWndOption->m_nStyle & RHWO_TOOLBAR)? 1: 0));
- hr=pBrowser->put_AddressBar((short)((a_pWndOption->m_nStyle & RHWO_LOCATION)? 1: 0));
- hr=pBrowser->put_MenuBar((short)((a_pWndOption->m_nStyle & RHWO_MENUBAR)? 1: 0));
- hr=pBrowser->put_Resizable((short)((a_pWndOption->m_nStyle & RHWO_RESIZABLE)? 1: 0));
- hr=pBrowser->put_StatusBar((short)((a_pWndOption->m_nStyle & RHWO_STATUS)? 1: 0));
-
-
- if (a_pWndOption->m_nTop >= 0)
- hr=pBrowser->put_Top(a_pWndOption->m_nTop);
- if (a_pWndOption->m_nWidth > 0)
- hr=pBrowser->put_Width(a_pWndOption->m_nWidth);
- if (a_pWndOption->m_nHeight > 0)
- hr=pBrowser->put_Height(a_pWndOption->m_nHeight);
- if (a_pWndOption->m_nLeft >= 0)
- hr=pBrowser->put_Left(a_pWndOption->m_nLeft);
-
- IDispatch *pDocumentDispatch = NULL;
- pBrowser->get_Document(&pDocumentDispatch);
- if (pDocumentDispatch!=NULL)
- {
- IHTMLDocument2 *pDocument=NULL;
- pDocumentDispatch->QueryInterface(IID_IHTMLDocument2, (void**)&pDocument);
- if (pDocument!=NULL)
- {
- IHTMLElement *pBody=NULL;
- pDocument->get_body(&pBody);
- if (pBody!=NULL)
- {
- BSTR bstrscroll;
- char szScroll[]="scroll";
- int nScrollLen=strlen(szScroll);
- bstrscroll = ::SysAllocStringLen(NULL, nScrollLen);
- MultiByteToWideChar(CP_ACP, MB_USEGLYPHCHARS, szScroll, nScrollLen, bstrscroll, nScrollLen);
-
- VARIANT vValue = {0};
- V_VT(&vValue) = VT_BSTR;
- if (a_pWndOption->m_nStyle & RHWO_SCROLLBARS)
- V_BSTR(&vValue) = SysAllocString(L"yes");
- else
- V_BSTR(&vValue) = SysAllocString(L"no");
-
- pBody->setAttribute(bstrscroll,vValue, 0);
- pBody->Release();
- }
- pDocument->Release();
- }
- pDocumentDispatch->Release();
- }
-
- //make it visiable
- HWND hWnd;
- hr=pBrowser->get_HWND((long*)&hWnd);
- if (SUCCEEDED(hr))
- {
- ::SetWindowPos(hWnd,HWND_TOP,0,0,0,0,SWP_NOSIZE|SWP_NOMOVE);
- }
- hr=pBrowser->put_Visible(TRUE);
-
- pBrowser->Release();
- return 1;
- }
-
- static int ShowHelpTopic_Win32_NonIE(const char *a_pszUrl,RH_WindowOption *a_pWndOption)
- {
- //create a temp html file which will redirect it self to desired url
- char szPath[MAX_PATH + 1];
- char szFile[MAX_PATH + 1];
- char szTopicParam[_MAX_PATH];
- char strTop[20], strScreenY[20], strLeft[20], strScreenX[20], strHeight[20], strWidth[20], strOuterHeight[20], strOuterWidth[20];
-
- GetTempPath(MAX_PATH, szPath);
- strcpy(szFile, szPath);
- strcat(szFile, "robohelp_csh.htm");
- OFSTRUCT of;
- HFILE hFile = OpenFile(szFile, &of, OF_WRITE|OF_CREATE);
- char szTempFileFormat[] = "<html>\r\n"
- "<script language=\"Javascript\">\r\n"
- "<!--\r\n"
- "document.location=\"file://%s\";\r\n"
- "//-->\r\n"
- "</script>\r\n"
- "</html>";
-
- szTopicParam[0] = '\0';
- char *pPos = strchr(a_pszUrl, '\\');
- while (pPos != NULL)
- {
- pPos[0] = '/';
- pPos = strchr(pPos, '\\');
- }
- if (a_pWndOption->m_nStyle & RHWO_LOCATION) {
- strcat(szTopicParam, ",location=yes");
- }
- else {
- strcat(szTopicParam, ",location=no");
- }
-
- if (a_pWndOption->m_nStyle & RHWO_MENUBAR) {
- strcat(szTopicParam, ",menubar=yes");
- }
- else {
- strcat(szTopicParam, ",menubar=no");
- }
-
- if (a_pWndOption->m_nStyle &RHWO_RESIZABLE) {
- strcat(szTopicParam, ",resizable=yes");
- }
- else {
- strcat(szTopicParam, ",resizable=no");
- }
-
- if (a_pWndOption->m_nStyle &RHWO_TOOLBAR) {
- strcat(szTopicParam, ",toolbar=yes");
- }
- else {
- strcat(szTopicParam, ",toolbar=no");
- }
-
- if (a_pWndOption->m_nStyle &RHWO_STATUS) {
- strcat(szTopicParam, ",status=yes");
- }
- else {
- strcat(szTopicParam, ",status=no");
- }
-
- if (a_pWndOption->m_nStyle &RHWO_SCROLLBARS) {
- strcat(szTopicParam, ",scrollbars=yes");
- }
- else {
- strcat(szTopicParam, ",scrollbars=no");
- }
-
- if (a_pWndOption->m_nTop >= 0)
- {
- sprintf(strTop, ",top=%d", a_pWndOption->m_nTop);
- strcat(szTopicParam, strTop);
- sprintf(strScreenY, ",screenY=%d", a_pWndOption->m_nTop);
- strcat(szTopicParam, strScreenY);
- }
-
- if (a_pWndOption->m_nLeft >= 0)
- {
- sprintf(strLeft, ",left=%d", a_pWndOption->m_nLeft);
- strcat(szTopicParam, strLeft);
- sprintf(strScreenX, ",screenX=%d", a_pWndOption->m_nLeft);
- strcat(szTopicParam, strScreenX);
- }
-
-
- if (a_pWndOption->m_nHeight > 0)
- {
- sprintf(strHeight, ",height=%d", a_pWndOption->m_nHeight);
- strcat(szTopicParam, strHeight);
- sprintf(strOuterHeight, ",outerHeight=%d", a_pWndOption->m_nHeight);
- strcat(szTopicParam, strOuterHeight);
- }
-
- if (a_pWndOption->m_nWidth > 0)
- {
- sprintf(strWidth, ",width=%d", a_pWndOption->m_nWidth);
- strcat(szTopicParam, strWidth);
- sprintf(strOuterWidth, ",outerWidth=%d", a_pWndOption->m_nWidth);
- strcat(szTopicParam, strOuterWidth);
- }
-
- char szTotalUrl[_MAX_PATH + _MAX_PATH];
- strcpy(szTotalUrl, a_pszUrl);
- strcat(szTotalUrl, szTopicParam);
- int len = strlen(szTempFileFormat) + strlen(szTotalUrl);
- unsigned long wlen = 0;
- char *pszFullBuffer = new char[len + 1];
- sprintf(pszFullBuffer, szTempFileFormat, szTotalUrl);
- WriteFile((HANDLE)hFile, pszFullBuffer, len, &wlen, NULL);
- CloseHandle((HANDLE)hFile);
- delete[] pszFullBuffer;
-
- //run shell execute to launch default browsre to view it
- if ((int)ShellExecute(NULL, "opennew", szFile, NULL, NULL, SW_SHOWNORMAL) > 32)
- return ShowHelpTopic_NonWin32(a_pszUrl);
-
- return 0;
- }
- #endif
-
-